package eerbaar.expression.internal.lib;

import java.util.ArrayList;
import java.util.List;

import eerbaar.expression.IExpression;

public abstract class AbstractExpression implements IExpression {

    private final List<IExpression> expressions = new ArrayList<IExpression>();

    private final String type;

    public AbstractExpression(String type) {
        this.type = type;
    }

    @Override
    public void addExpression(IExpression expression) {

        this.expressions.add(expression);
    }

    public void addWhen(IExpression expression) {

        this.expressions.add(expression);
    }

    @Override
    public IExpression[] getExpressions() {

        return this.expressions.toArray(new IExpression[] {});
    }

    @Override
    public String getType() {
        return this.type;
    }

    @Override
    public void start() {

    }

    @Override
    public void stop() {

    }

    @Override
    public String toString() {
        return this.type;
    }

}
